package com.henghe.frame.domain.entity;

import com.henghe.frame.common.util.ServletUtils;

/**
 * Description:
 * Author: LiuWenQing
 * Datetime: 2023/3/16 16:18
 */
public class TableSupport {

    public static final String PAGE_INDEX = "page_index";

    public static final String PAGE_SIZE = "page_size";

    public static final String ORDER_BY_COLUMN = "order_by";

    public static final String IS_ASC = "isAsc";

    /**
     * 封装分页对象
     */
    public static PageDomain getPageDomain() {
        PageDomain pageDomain = new PageDomain();
        pageDomain.setPageIndex(ServletUtils.getParameterToInt(PAGE_INDEX));
        pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE));
        pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
        pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
        return pageDomain;
    }

    public static PageDomain buildPageRequest() {
        return getPageDomain();
    }

}
